<%@ taglib prefix="s" uri="/struts-tags"%>
<%@ page language="java" import="java.util.*" pageEncoding="UTF-8"%>
<%
	String path = request.getContextPath();
	String basePath = request.getScheme() + "://"
			+ request.getServerName() + ":" + request.getServerPort()
			+ path + "/";
%>

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
<head>
<base href="<%=basePath%>">

<title>增加具体服务</title>

<meta http-equiv="pragma" content="no-cache">
<meta http-equiv="cache-control" content="no-cache">
<meta http-equiv="expires" content="0">
<meta http-equiv="keywords" content="keyword1,keyword2,keyword3">
<meta http-equiv="description" content="This is my page">
<!--
<link rel="stylesheet" type="text/css" href="styles.css">
-->
<!-- 新 Bootstrap 核心 CSS 文件 -->
<link
	href="http://cdn.static.runoob.com/libs/bootstrap/3.3.7/css/bootstrap.min.css"
	rel="stylesheet">

<!-- 可选的Bootstrap主题文件（一般不使用） -->
<script
	src="http://cdn.static.runoob.com/libs/bootstrap/3.3.7/css/bootstrap-theme.min.css"></script>

<!-- jQuery文件。务必在bootstrap.min.js 之前引入 -->
<script
	src="http://cdn.static.runoob.com/libs/jquery/2.1.1/jquery.min.js"></script>

<!-- 最新的 Bootstrap 核心 JavaScript 文件 -->
<script
	src="http://cdn.static.runoob.com/libs/bootstrap/3.3.7/js/bootstrap.min.js"></script>

<link rel="stylesheet" href="css/home.css">
<!-- 标签页logo -->
<link rel="shortcut icon" href="img/logo2.ico"/>

<script>
	// 判断不能为空
	function myFunction() {
		var y = document.forms["serviceForm"]["service.serviceName"].value;
		if (y == null || y == "") {
			alert("服务名称必须填写");
			return false;
		}
		// 获取 id="service.servicePrice" 的值
		var x = document.getElementById("service.servicePrice").value;

		// 如果输入的值 x 不是数字，则提示错误 
		if (parseFloat(x).toString() == "NaN") {
			//if (!isNaN(x)) {
			alert("请填写数字格式，如：50");
			return false;
		}

	}

</script>
</head>
<body>
	<div id="addSerCate">
		<div>
			<h3>添加具体服务</h3>
		</div>
		<form name="serviceForm" onsubmit="return myFunction()"
			action="addService.action" method="post">
			<div class="form-group">
				<label for="name">服务名称</label> <input type="text"
					class="form-control" id="name" placeholder="请输入名称（必须）"
					name="service.serviceName">
			</div>
			<div class="form-group">
				<label for="name">注释</label> <input type="text" class="form-control"
					id="name" placeholder="请输入注释（可选）" name="service.remark">
			</div>
			<div class="form-group">
				<label for="name">价格</label> <input type="number"
					class="form-control" id="service.servicePrice"
					placeholder="请输入价格（必须）" name="service.servicePrice">
			</div>
			<div class="form-group">
				<label for="name">类型</label>
				<%-- <input type="hidden" name="serCateId"
					value="<s:property value="#list.id"/>">  --%>
				<select name="serCateId" class="form-control">
					<s:iterator value="list" var="list">
						<option name="service.serCateId"
							value="<s:property value="#list.id"/>">
							<s:property value="#list.serCateName" />
						</option>
					</s:iterator>
				</select>
			</div>

			<button type="submit" class="btn btn-success btn-block">添加</button>
		</form>

		<div id="btnhome">
			<a class="btn btn-info btn-block" href="home.jsp" role="button">返回主页</a>
		</div>

	</div>
</body>
</html>
